package sb.entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 *
 * @author Pavel
 */
@Entity
@NamedQueries({
	@NamedQuery(name = "partnerSelectAll", query = "SELECT t FROM Partner t ORDER BY t.isFolder DESC, t.code"),
	@NamedQuery(name = "partnerFindById", query = "SELECT t FROM Partner t WHERE t.id = :id")
})
public class Partner implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
	protected Long id;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	protected String code;
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	
	protected String name;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	protected Boolean deletionMark = false;
	public Boolean getDeletionMark() {
		return deletionMark;
	}
	public void setDeletionMark(Boolean deletionMark) {
		this.deletionMark = deletionMark;
	}
	
	protected Boolean isFolder = false;
	public Boolean getIsFolder() {
		return isFolder;
	}
	public void setIsFolder(Boolean isFolder) {
		this.isFolder = isFolder;
	}
	
	protected Long parentId;
	public Long getParentId() {
		return parentId;
	}
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}
	
	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		if (!(object instanceof Partner)) {
			return false;
		}
		Partner other = (Partner) object;
		if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "sb.partner.Partner[ id=" + id + " ]";
	}

}
